package edu.cicese.alz.swing;

import edu.cicese.alz.reports.ActivityThresholds;

import javax.swing.JList;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import java.awt.Color;
import java.awt.Component;

/**
 * Created by: Eduardo Quintana Contreras
 * Date: 8/08/12
 * Time: 02:09 PM
 */
public class ActivityThresholdRenderer extends BasicComboBoxRenderer {

	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		if (value != null) {
			setText(((ActivityThresholds) value).getName());
			list.setToolTipText(((ActivityThresholds) value).getToolTip());
			if (isSelected) {
				setBackground(SwingUtil.cRollover);
			} else {
				setBackground(Color.WHITE);
			}
		}
		return this;
	}
}